package com.itheima.chapter10.thread.demo3;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
//Callable Future接口实现多线程
public class Demo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc =new MyCallable();
        FutureTask<String > ft =new FutureTask<>(mc);
        Thread t =new Thread(ft);
        t.start();
        System.out.println("---------------");
        //再用get 方法获取线程结果
        String s = ft.get();
        System.out.println(s);
    }
}
